home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / p_man / cat3 / sigtrap.Z / sigtrap
Encoding:
Text File  |  1998-10-28  |  8.1 KB  |  265 lines

  1.  
  2.  
  3.  
  4.      ssssiiiiggggttttrrrraaaapppp((((3333))))         22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))        ssssiiiiggggttttrrrraaaapppp((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       sigtrap - Perl pragma    to enable simple signal    handling
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.           use sigtrap;
  13.           use sigtrap qw(stack-trace old-interface-signals);  # equivalent
  14.           use sigtrap qw(BUS SEGV PIPE ABRT);
  15.           use sigtrap qw(die INT QUIT);
  16.           use sigtrap qw(die normal-signals);
  17.           use sigtrap qw(die untrapped normal-signals);
  18.           use sigtrap qw(die untrapped normal-signals
  19.                   stack-trace any error-signals);
  20.           use sigtrap 'handler' => \&my_handler, 'normal-signals';
  21.           use sigtrap qw(handler my_handler    normal-signals
  22.                   stack-trace error-signals);
  23.  
  24.  
  25.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  26.       The ssssiiiiggggttttrrrraaaapppp pragma is    a simple interface to installing
  27.       signal handlers.  You    can have it install one    of two
  28.       handlers supplied by ssssiiiiggggttttrrrraaaapppp itself (one which provides a
  29.       Perl stack trace and one which simply    die()s), or
  30.       alternately you can supply your own handler for it to
  31.       install.  It can be told only    to install a handler for
  32.       signals which    are either untrapped or    ignored.  It has a
  33.       couple of lists of signals to    trap, plus you can supply your
  34.       own list of signals.
  35.  
  36.       The arguments    passed to the use statement which invokes
  37.       ssssiiiiggggttttrrrraaaapppp are processed    in order.  When    a signal name or the
  38.       name of one of ssssiiiiggggttttrrrraaaapppp's signal lists    is encountered a
  39.       handler is immediately installed, when an option is
  40.       encountered it affects subsequently installed    handlers.
  41.  
  42.      OOOOPPPPTTTTIIIIOOOONNNNSSSS
  43.       SSSSIIIIGGGGNNNNAAAALLLL HHHHAAAANNNNDDDDLLLLEEEERRRRSSSS
  44.  
  45.       These    options    affect which handler will be used for
  46.       subsequently installed signals.
  47.  
  48.       ssssttttaaaacccckkkk----ttttrrrraaaacccceeee
  49.           The handler used for subsequently    installed signals
  50.           outputs a    Perl stack trace to STDERR and then tries to
  51.           dump core.  This is the default signal handler.
  52.  
  53.       ddddiiiieeee The handler used for subsequently    installed signals
  54.           calls die    (actually croak) with a    message    indicating
  55.           which signal was caught.
  56.  
  57.       hhhhaaaannnnddddlllleeeerrrr _y_o_u_r-_h_a_n_d_l_e_r
  58.           _y_o_u_r-_h_a_n_d_l_e_r will    be used    as the handler for
  59.           subsequently installed signals.  _y_o_u_r-_h_a_n_d_l_e_r can    be any
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      ssssiiiiggggttttrrrraaaapppp((((3333))))         22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))        ssssiiiiggggttttrrrraaaapppp((((3333))))
  71.  
  72.  
  73.  
  74.           value which is valid as an assignment to an element of
  75.           %SIG.
  76.  
  77.       SSSSIIIIGGGGNNNNAAAALLLL LLLLIIIISSSSTTTTSSSS
  78.  
  79.       ssssiiiiggggttttrrrraaaapppp has a    few built-in lists of signals to trap.    They
  80.       are:
  81.  
  82.       nnnnoooorrrrmmmmaaaallll----ssssiiiiggggnnnnaaaallllssss
  83.           These are    the signals which a program might normally
  84.           expect to    encounter and which by default cause it    to
  85.           terminate.  They are HUP,    INT, PIPE and TERM.
  86.  
  87.       eeeerrrrrrrroooorrrr----ssssiiiiggggnnnnaaaallllssss
  88.           These signals usually indicate a serious problem with
  89.           the Perl interpreter or with your    script.     They are
  90.           ABRT, BUS, EMT, FPE, ILL,    QUIT, SEGV, SYS    and TRAP.
  91.  
  92.       oooolllldddd----iiiinnnntttteeeerrrrffffaaaacccceeee----ssssiiiiggggnnnnaaaallllssss
  93.           These are    the signals which were trapped by default by
  94.           the old ssssiiiiggggttttrrrraaaapppp interface, they are ABRT,    BUS, EMT, FPE,
  95.           ILL, PIPE, QUIT, SEGV, SYS, TERM,    and TRAP.  If no
  96.           signals or signals lists are passed to ssssiiiiggggttttrrrraaaapppp, this
  97.           list is used.
  98.  
  99.       For each of these three lists, the collection    of signals set
  100.       to be    trapped    is checked before trapping; if your
  101.       architecture does not    implement a particular signal, it will
  102.       not be trapped but rather silently ignored.
  103.  
  104.       OOOOTTTTHHHHEEEERRRR
  105.  
  106.       uuuunnnnttttrrrraaaappppppppeeeedddd
  107.           This token tells ssssiiiiggggttttrrrraaaapppp to install handlers only    for
  108.           subsequently listed signals which    aren't already trapped
  109.           or ignored.
  110.  
  111.       aaaannnnyyyy This token tells ssssiiiiggggttttrrrraaaapppp to install handlers for all
  112.           subsequently listed signals.  This is the    default
  113.           behavior.
  114.  
  115.       _s_i_g_n_a_l
  116.           Any argument which looks like a signal name (that    is,
  117.           /^[A-Z][A-Z0-9]*$/) indicates that ssssiiiiggggttttrrrraaaapppp should
  118.           install a    handler    for that name.
  119.  
  120.       _n_u_m_b_e_r
  121.           Require that at least version _n_u_m_b_e_r of ssssiiiiggggttttrrrraaaapppp is being
  122.           used.
  123.  
  124.      EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  125.       Provide a stack trace    for the    old-interface-signals:
  126.  
  127.  
  128.  
  129.      Page 2                        (printed 10/23/98)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      ssssiiiiggggttttrrrraaaapppp((((3333))))         22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))        ssssiiiiggggttttrrrraaaapppp((((3333))))
  137.  
  138.  
  139.  
  140.           use sigtrap;
  141.  
  142.       Ditto:
  143.  
  144.           use sigtrap qw(stack-trace old-interface-signals);
  145.  
  146.       Provide a stack trace    on the 4 listed    signals    only:
  147.  
  148.           use sigtrap qw(BUS SEGV PIPE ABRT);
  149.  
  150.       Die on INT or    QUIT:
  151.  
  152.           use sigtrap qw(die INT QUIT);
  153.  
  154.       Die on HUP, INT, PIPE    or TERM:
  155.  
  156.           use sigtrap qw(die normal-signals);
  157.  
  158.       Die on HUP, INT, PIPE    or TERM, except    don't change the
  159.       behavior for signals which are already trapped or ignored:
  160.  
  161.           use sigtrap qw(die untrapped normal-signals);
  162.  
  163.       Die on receipt one of    an of the nnnnoooorrrrmmmmaaaallll----ssssiiiiggggnnnnaaaallllssss which is
  164.       currently uuuunnnnttttrrrraaaappppppppeeeedddd, provide a stack trace on    receipt    of aaaannnnyyyy
  165.       of the eeeerrrrrrrroooorrrr----ssssiiiiggggnnnnaaaallllssss:
  166.  
  167.           use sigtrap qw(die untrapped normal-signals
  168.                   stack-trace any error-signals);
  169.  
  170.       Install _m_y__h_a_n_d_l_e_r() as the handler for the nnnnoooorrrrmmmmaaaallll----ssssiiiiggggnnnnaaaallllssss:
  171.  
  172.           use sigtrap 'handler', \&my_handler, 'normal-signals';
  173.  
  174.       Install _m_y__h_a_n_d_l_e_r() as the handler for the normal-signals,
  175.       provide a Perl stack trace on    receipt    of one of the error-
  176.       signals:
  177.  
  178.           use sigtrap qw(handler my_handler    normal-signals
  179.                   stack-trace error-signals);
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                        (printed 10/23/98)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      ssssiiiiggggttttrrrraaaapppp((((3333))))         22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))        ssssiiiiggggttttrrrraaaapppp((((3333))))
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.      Page 4                        (printed 10/23/98)
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.